switch: Shorten size_allocate impl a bit
authorTimm Bäder <mail@baedert.org>
Tue, 20 Nov 2018 17:11:50 +0000 (18:11 +0100)
committerTimm Bäder <mail@baedert.org>
Tue, 27 Nov 2018 04:37:38 +0000 (05:37 +0100)
gtk/gtkswitch.c

index f8c235fe6938c2b5f595e156be7f3e5143953449..a1a1bcdc9b853535b4b36b9e7411f0bc79b01e80 100644 (file)
@@ -324,16 +324,13 @@ gtk_switch_size_allocate (GtkWidget *widget,
   GtkSwitch *self = GTK_SWITCH (widget);
   GtkSwitchPrivate *priv = gtk_switch_get_instance_private (self);
   GtkAllocation child_alloc;
-  GtkAllocation slider_alloc;
   int min;
 
-  slider_alloc.x = round (priv->handle_pos * (width / 2));
-  slider_alloc.y = 0;
-  slider_alloc.width = width / 2;
-  slider_alloc.height = height;
-
-  gtk_widget_size_allocate (priv->slider, &slider_alloc, -1);
-
+  gtk_widget_size_allocate (priv->slider,
+                            &(GtkAllocation) {
+                              round (priv->handle_pos * (width / 2)), 0,
+                              width / 2, height
+                            }, -1);
 
   /* Center ON label in left half */
   gtk_widget_measure (priv->on_label, GTK_ORIENTATION_HORIZONTAL, -1, &min, NULL, NULL, NULL);